﻿using System;
using Jayden.Dll.Web.Enums;
using Jayden.Dll.Web.HtmlControls.Descriptions;
using Jayden.Dll.Web.HtmlControls.Generics;
using Jayden.Dll.Web.HtmlControls.Interfaces;

namespace Jayden.Dll.Web.HtmlControls
{
	public class Keygen : HtmlElement, WithName, WithAutoFocus, WithDisabled, WithForm
	{
		public Keygen() : base(KeygenDescription.Instance) { }

		public string Challenge { get { return this["challenge"]; } set { this["challenge"] = value; } }
		public string KeyType { get { return this["keytype"]; } set { this["keytype"] = value; } }
		public string Form { get { return this["form"]; } set { this["form"] = value; } }
		public string Name { get { return this["name"]; } set { this["name"] = value; } }
		public bool AutoFocus { get { return GetAttributeBool("autofocus"); } set { SetAttribute("autofocus", value); } }
		public bool Disabled { get { return GetAttributeBool("disabled"); } set { SetAttribute("disabled", value); } }
		public bool Enabled { get { return !Disabled; } set { Disabled = !value; } }
	}
	public class KeygenDescription : HtmlElementDescription
	{
		public static readonly KeygenDescription Instance = new KeygenDescription();
		private KeygenDescription() : base("keygen", HtmlVersion.Html5, false, false) { }
		public override Type ControlType { get { return typeof(Keygen); } }
		public override string Description { get { return "control for generating a public-private key pair and for submitting the public key from that key pair."; } }
	}
}
